package net.babypai.widget;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.view.View;

public class BpDialogBuilder extends AlertDialog.Builder {

	private BpDialog md;
	private Context context;

	public BpDialogBuilder(Context context) {
		super(context);
		md = new BpDialog(context);
		this.context = context;
		md.setCanceledOnTouchOutside(false);
	}

	public BpDialogBuilder setTitle(int titleId) {
		md.setTitle(context.getResources().getString(titleId));
		return this;
	}

	public BpDialogBuilder setTitle(CharSequence title) {
		md.setTitle(title);
		return this;
	}
	
	public BpDialogBuilder setNoTitle() {
		md.setNoTitle();
		return this;
	}
	
	public BpDialogBuilder setNoView() {
		md.setNoView();
		return this;
	}
	
	public BpDialogBuilder setViewText(int titleId) {
		md.setViewText(context.getResources().getString(titleId));
		return this;
	}
	
	public BpDialogBuilder setViewText(CharSequence title) {
		md.setViewText(title);
		return this;
	}
	
	public BpDialogBuilder setView(View view) {
		md.setView(view);
		return this;
	}

	public BpDialogBuilder setPositiveButton(int textId,
			OnClickListener listener) {
		md.setButton(context.getResources().getString(textId), listener);
		return this;
	}

	public BpDialogBuilder setPositiveButton(CharSequence text,
			OnClickListener listener) {
		md.setButton(text, listener);
		return this;
	}

	public BpDialogBuilder setNegativeButton(int textId,
			OnClickListener listener) {
		md.setButton3(context.getResources().getString(textId), listener);
		return this;
	}

	public BpDialogBuilder setNegativeButton(CharSequence text,
			OnClickListener listener) {
		md.setButton3(text, listener);
		return this;
	}

	@Override
	public BpDialog create() {
		return md;
	}
	
	
}